package fem2;

import fem2.enu.EchoLevelType;

/**
 * 
 * @author hbui
 * 
 */
public class EchoLevel {

	private int value;

	EchoLevel() {
		this.value = EchoLevelType.NONE.getValue();
	}

	public int getValue() {
		return this.value;
	}

	public void add(EchoLevelType e) {
		this.value |= e.getValue();
	}

	public void remove(EchoLevelType e) {
		this.value &= (0xff - e.getValue());
	}

	public boolean contain(EchoLevelType e) {
		if (e == null)
			return false;
		return ((this.value & e.getValue()) == e.getValue());
	}

	public static void main(String[] args) {
		EchoLevel a = new EchoLevel();
		a.add(EchoLevelType.DEBUG);
		a.add(EchoLevelType.OUTPUT);
		a.remove(EchoLevelType.OUTPUT);
		System.out.println(a.contain(EchoLevelType.DEBUG));
		System.out.println(a.contain(EchoLevelType.OUTPUT));
		System.out.println(a.contain(EchoLevelType.NONE));
		System.out.println(a.contain(EchoLevelType.AUX1));
		System.out.println(a.contain(EchoLevelType.AUX2));
		System.out.println(a.contain(EchoLevelType.AUX3));
	}
}
